//
// Created by rany on 1/18/17.
//

#ifndef CHATROM_USER_H
#define CHATROM_USER_H

#include <pthread.h>

typedef struct User {
    int id;
    char name[15];
    int conn;
    pthread_t thread;
} user_t, *puser;

struct UserNode {
    user_t user;
    struct UserNode * next;
};

typedef struct UserList {
    struct UserNode * users;
    int count;
} userList_t;

userList_t * initUserList();
void insertUser(userList_t * list, user_t user);
void deleteUser(userList_t * list, user_t user);
void deleteUserByName(userList_t * list, char * name);
user_t getUser(userList_t * list, char * username);
struct UserNode * searchNode(userList_t * list, char * name);

#endif //CHATROM_USER_H
